package com.cg.controller;

import com.alibaba.nacos.api.model.v2.Result;
import com.cg.client.OrderClient;
import com.cg.entity.User;
import com.cg.vo.LoginUserVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author CG
 * @Date 2024/1/14 20:04
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private OrderClient orderClient;

    /**
     * 添加新用户
     */
    @PostMapping("/createUser")
    public Result createUser(User user){
        return orderClient.createUser(user);
    }

    /**
     * 用户登录
     */
    @PostMapping("/login")
    public Result<LoginUserVo> login(User user){
        return orderClient.login(user);
    }
}
